<!--
  @Descripttion:：简历编辑，通过抽屉弹出简历预览（特殊）
  @Author：yejianbo
  @Date：2022年07月11日
-->
<template>
    <section class="container" :hideHeadFooter="true">
        <!-- 列表 -->
        <el-table v-loading="loading" :data="list">
        <el-table-column label="序号" type="index" />
        <el-table-column label="填写人" align="center" prop="nickname" />
        <el-table-column label="企业名称" align="center" prop="companyName" />
        <el-table-column label="备注内容" align="center" prop="remarks" />
        <el-table-column label="填写日期" align="center" prop="createTime">
            <template slot-scope="scope">
            <span>{{ moment(scope.row.createTime).format('yyyy-MM-DD HH:mm') }}</span>
            </template>
        </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNo"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
        />
    </section>
</template>
<script>
import { mapState } from "vuex";
import { getAge } from "@/utils/utils";
import { deepClone } from '@/utils/index'
import moment from 'moment'
import {
  getNotesPage
} from '@/api/school-admin-api/hireManage/index.js'
import {
    getEnterpriseNotesPage
} from '@/api/company-admin-api/hireManage/index.js'
export default {
  // 组件名称
  name: "demo",
  // 组件参数 接收来自父组件的数据
  props: {
    relationType: {
      type: String,
      default: () => '1'
    },
    relationId: {
      type: Number,
    },
  },
  // 组件状态值
  data() {
    return {
        moment,
      // 遮罩层
      loading: true,
      // 简历列表-总条数
      total: 0,
      // 简历列表列表
      list: [],
      queryParams: {
        pageNo: 1,
        pageSize: 10,
      }
    };
  },
  watch: {
  },
  // 计算属性
  computed: {
  },
  created(){
    this.getList()
  },
  // 组件方法
  methods: {
    getList(){
        this.loading = true
        let params = {
            pageNo: this.queryParams.pageNo,
            pageSize: this.queryParams.pageSize,
            relationType: this.relationType,
            relationId: this.relationId,
        }
        
        /**
         * 关联类型:
         * 1:运营端(招聘管理-职位应聘),
         * 2:运营端(人才夹-学生列表),
         * 3:企业端(招聘管理-职位应聘),
         * 4:企业端(招聘管理-自主招聘),
         * 5:企业端(人才夹-学生列表)
         * */ 
        if(this.relationType>2){
            getEnterpriseNotesPage(params).then(res=>{
                this.loading = false
                if(res.data&&res.data.list&&res.data.list.length>0){
                    this.list = res.data.list
                    this.total = res.data.total
                }
            })  
        }else{
            getNotesPage(params).then(res=>{
                this.loading = false
                if(res.data&&res.data.list&&res.data.list.length>0){
                    this.list = res.data.list
                    this.total = res.data.total
                }
            })
        }
        
    }
  },
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.container{
    padding: 25px 30px;
}
</style>
